#include "AppConfigUtil.h"
#include "AppConfig.h"

#define BigLittleSwap32(A)  ((((uint32_t)(A) & 0xff000000) >> 24) | (((uint32_t)(A) & 0x00ff0000) >> 8) | (((uint32_t)(A) & 0x0000ff00) << 8) | (((uint32_t)(A) & 0x000000ff) << 24))


AppConfigUtil::AppConfigUtil()
{

}

uint32_t AppConfigUtil::getColor(const char* path, uint32_t defValue)
{
    uint32_t color(defValue);
    std::string str = AppConfig::instance().getString(path, "");
    if (str.size() > 0 && str[0] == '#')
    {
        color = std::strtoul(str.c_str() + 1, NULL, 16);

#ifdef WIN32
		//color = color << 8;
		//color = BigLittleSwap32(color);
#endif //

    }
    return color;
}
